﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Set
{
    //链表
    public class LinkedListSet<E> : Set<E>
    {

        private LinkedList<E> list;

        public LinkedListSet()
        {
            list = new LinkedList<E>();
        }


        public int getSize()
        {
            return list.Count;
        }


        public bool isEmpty()
        {
            return list.Count == 0;
        }


        public void add(E e)
        {
            if (!list.Contains(e))
                list.AddFirst(e);
        }


        public bool contains(E e)
        {
            return list.Contains(e);
        }


        public void remove(E e)
        {
            list.Remove(e);
        }

    }
}
